<template>
	<view class="page">

		<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex balanceDetails_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
			<view class='flex flex-wrap align-center justify-between balanceDetails_fd0_0'>
				<view class='flex flex-wrap align-center balanceDetails_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<text class='fu-iconfont2  balanceDetails_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='balanceDetails_fd0_0_c1_c0'>模拟考试</text>
				</view>
				<view class='flex align-center justify-end balanceDetails_fd0_0_c2'>
				</view>
			</view>

		</view>

		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局开始-->
		<!-- <view class="bulletin-text text-cut-2 text_title3 text0_title3 errorBox" @tap.stop="handleJumpDiy"
			data-type="navigateTo"
			:data-url="`/pages/shifu/wode/wrongTopicReview/wrongTopicReview?model=1&model_type=2`">
			<text>错题</text>
			<text>回顾</text>
		</view> -->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
			<!---测试列表开始-->
			<view class="flex flex-wrap align-center fd1_0" @tap.stop="handleJumpDiy" data-type="navigateTo"
				:data-url="`/pages/examinationQuestions/examinationQuestions?type=2&id=` +item.aid"
				v-for="(item,index) in list" :key="index">
				<view class="flex flex-direction flex-wrap align-stretch flex-sub">
					<text class="flex-sub fd1_0_c0_c0">{{item.shijuanmingcheng}}</text>

					<view class="flex flex-wrap align-stretch fd1_0_c0_c1">
						<text>最新成绩：</text>
						<text class="flex-sub">{{item.last_score}}分</text>
					</view>
				</view>

				<button class="fd1_0_c1" @tap.stop="handleJumpDiy" data-type="navigateTo"
					:data-url="`/pages/wode/examinationQuestions/examinationQuestions?type=2&id=` +item.aid">开始考试</button>
			</view>

			<UniLoadMore v-if="list.length>0" :status="status"></UniLoadMore>
			<fu-empty-ui v-if="list.length==0 && isEmpty"></fu-empty-ui>

			<!---测试列表结束-->
		</view>

		<!---flex布局结束-->
	</view>
</template>

<script>
	import UniLoadMore from '@/components/tsp-video/tsp-load/tsp-load-more.vue'
	// import {
	// 	validate
	// } from '@/components/uni-load-more/uni-load-more.vue'
	export default {
		components: {
			UniLoadMore
		},

		data() {
			return {
				fuTopNavigationBar: {
					backgroundColor: '#fff',
					backgroundImage: '',
					notTake: true
				},
				isEmpty: false,
				status: 'loading',
				page: 1,
				list: [],
				user: global.userInfo,
				newExam: {}, //当前试卷
			}
		},
		computed: {},
		watch: {},
		onLoad(options) {},
		onReady() {},
		onShow() {
			this.init();
			this.finalTest();
		},
		onPullDownRefresh() {
			this.init();
			this.finalTest();
			uni.stopPullDownRefresh()
		},
		onReachBottom(e) {
			if (this.status == 'loadmore') return false;
			this.page++;
			this.finalTest();
		},
		onPageScroll(e) {},
		methods: {
			// 初始化
			init() {
				this.status = 'loading';
				this.isEmpty = false;
				this.page = 1;
				this.list = [];
			},
			// 模拟列表
			finalTest() {
				this.$api.post(global.apiUrls.post6256bddfd1b6f, {
					sheet_type: 2,
					page: this.page
				}).then(res => {
					if (res.data.code == 1) {
						console.log('模拟列表', res);
						// res.data.data.data.map(item=>{
						// 	console.log(item.start_time.split(' ')[0].split('.').join('/'))
						// 	let newtimes = new Date().getTime();
						// 	let startime = new Date(item.start_time);
						// 	console.log(newtimes,startime)
						// })
						this.list.push(...res.data.data.data);
						this.getJudge(res.data.data.data, res.data.data.last_page);
					}
				})
			},
			//判断当前数据状态
			getJudge(data, lastpage) {
				if (this.page < lastpage) {
					this.status = 'more';
				} else {
					this.status = 'loadmore';
				}
				if (data.length == 0) {
					this.isEmpty = true;
				} else {
					this.isEmpty = false;
				}
			},
			// 开始考试弹窗显示
			startExam(item) {
				this.popupShow1648692129461 = true;
				this.newExam = item;
				// 显示个人资料，以及	考试标准
			}
		},
	}
</script>

<style lang="scss" scoped>
	.fd1_0 {
		border-bottom: 1px solid #eee;
		margin: 0rpx 32rpx 0rpx 32rpx;
		padding: 32rpx 0rpx 24rpx 0rpx;
	}

	.fd1_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.fd1_0_c0_c1 {
		line-height: 33rpx;
		font-weight: 400;
		font-size: 24rpx;
		color: rgba(153, 153, 153, 1);
		padding: 16rpx 0rpx 0rpx 0rpx;
	}

	.fd1_0_c1 {
		background: rgb(35, 109, 248);
		background-size: 100% !important;
		line-height: 56rpx;
		border-radius: 36rpx 36rpx 36rpx 36rpx;
		font-size: 24rpx;
		color: rgba(253, 253, 253, 1);
		width: 156rpx;
		margin: 0rpx 0rpx 0rpx 60rpx;
	}

	.text_title3 {
		font-size: 32rpx;
		font-weight: 400rpx;
		width: 145rpx;
		color: rgba(186, 96, 34, 1);
	}

	.text0_title3 {
		color: rgba(186, 96, 34, 1);
	}

	.errorBox {
		position: fixed;
		right: 10rpx;
		bottom: 500rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		background: #abcdef;
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
	}

	.text_title1 {
		font-size: 36rpx;
		font-weight: 500rpx;
		width: 550rpx;
		color: #333;
	}

	.icon_title0 {
		font-size: 36rpx;
		font-weight: 600;
		color: #333;
	}

	.icon0_title0 {
		color: #333;
	}

	.page {
		min-height: 100vh;
		background: #fff;
		background-size: 100% auto !important;
		position: relative;
	}

	.balanceDetails_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.balanceDetails_fd0_0_c2 {
		width: 100rpx;
		height: 88rpx;
	}

	.balanceDetails_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.balanceDetails_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
		font-weight: 500;
	}

	.balanceDetails_fd0_0_c0 {
		width: 100rpx;
	}

	.balanceDetails_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}
</style>